package com.ciaojian.client.model.param;

import cn.hutool.core.bean.BeanUtil;
import com.ciaojian.core.model.ProtocolUserRecord;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotNull;

/**
 * @author oxiny
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class ProtocolAgreeDTO extends BaseDTO<ProtocolUserRecord> {
    @ApiModelProperty("用户ID")
    @NotNull(message = "用户ID不能为空")
    private Integer userId;

    @ApiModelProperty("协议ID")
    @NotNull(message = "协议ID不能为空")
    private Integer protocolId;

    @ApiModelProperty("状态 0未同意 1已同意")
    @NotNull(message = "状态不能为空")
    private Integer status;

    /**
     * 转换为实体
     *
     * @return /
     */
    public ProtocolUserRecord convert() {
        ProtocolUserRecord protocolUserRecord = ProtocolUserRecord.builder().build();
        BeanUtil.copyProperties(this,protocolUserRecord);
        return protocolUserRecord;
    }
}
